package com.neo.base.array

object ArrayTest {
  def apply(str: String, str1: String, str2: String) = ???

  def main(args: Array[String]): Unit = {
    val big  = new java.math.BigInteger("123456")
    val greetString  = new Array[String](3)
    greetString(0)  = "Hello "
    greetString(1) = "world"
    greetString(2) = "!\n"
    greetString.foreach(print)

    for(i <- 0 to 2)
      println(greetString(i))


    val greetString1: Array[String]  = new Array[String](3)

    greetString1(0)  = "Hello s"
    greetString1(1) = "world s"
    greetString1(2) = "s!\n"
    greetString1.foreach(print)

    println(1.+(2))

    greetString1.update(1,"asdfasdf")
    for(i <- 0 to 2)
      println(greetString1.apply(i)) //这里访问greetString1的元素用的是括号，类似于调用方法



    //scala 更加简洁的创建数组的方法

    val greetString2 = Array("Three","two","one")

    for(i <- 0 to 2)
      println(greetString2.apply(i))

    greetString2.foreach(arg => println(arg))
    greetString2.foreach(println)
  }

}
